
import {axios,get,post,Delete,Patch} from './request'

// 项目的所有请求 包装这里
export const ajax = {
    test:(params)=>get('/api/test',params),
    register:(data)=>post('/api/user',data),  // 添加信息 
    findUser:(params)=>get('/api/user',params), // 查询用户 
    changeuser:(id,params)=>Patch('/api/user/'+id,params),

    getCaptcha:(params)=>get('/yun/captcha/sent',params),   // 发送验证码

    checkCaptcha:(params)=>get('/yun/captcha/verify',params),   // 验证验证码

    getMZdata:(params,headers)=>get('/abc/cn/oapi/configs/web/banners/040101,040201',params,headers),   // 
  
    getMZdata1:(params,headers)=>get('/abc/cn/oapi/configs/web/icons/040202,040203',params,headers), 
    getMZdata2:(params,headers)=>get('/abc/cn/oapi/goods-business/category/first',params,headers), 
    getMZdata3:(params,headers)=>get('/abc/cn/oapi/goods-business/category/first/detail?code=000024',params,headers), 
    findGoods:(params)=>get('/api/goods',params), //js数据
    getOPbanner:(params)=>get("/abc/cn/oapi/configs/web/banners/040101,040201",params)
    , 
    getOPnav:(params)=>get("/abc/cn/oapi/configs/web/icons/040202,040203"),
    getOPphone:(params)=>get("/abc/cn/oapi/goods/web/products/v15/040204"),
    getOPxq:(params)=>get('/abc/cn/oapi/goods/web/info/skuId',params),
    getOPfl1:(params)=>get('/abc/cn/oapi/goods-business/category/first/detail?code=000024&scene=mall&preview=false',params),
    getOPfl2:(params)=>get('/abc/cn/oapi/goods-business/category/first/detail?code=000078&scene=mall&preview=false',params),

    postMZdata:(data,params,headers)=>post('abc/cn/oapi/configs/web/banners/040101,040201',data,params,headers),   // POST

    getGoods:(params)=>get('/api/getGoods',params), // mock 商品数据  

    findGoods:(params)=>get('/api/goods',params), // json-server 商品数据  

    findLikes:(params)=>get('/api/likes',params), // json-server 商品数据 

    DeleteLikes:(id,params)=>Delete('/api/likes/'+id,params), // json-server 点赞商品数据 
    DeletesLikes:(id,params)=>Delete('/api/like/'+id,params), // json-server 收藏商品数据 

    AddLikes:(data,params)=>post('/api/likes',data,params), // json-server 点赞商品数据  
    AddsLikes:(data,params)=>post('/api/like',data,params), // json-server 收藏商品数据
    findLike:(params)=>get('/api/like',params), // json-server 收藏商品数据

    findcart:(params)=>get('/api/cart',params), // json-server 商品数据 
    deletecart:(id)=>Delete('/api/cart/'+id), // json-server 商品数据 

    addcart:(data,params)=>post('/api/cart',data,params) , //添加购物车

    setcart:(id,data)=>Patch('/api/cart/'+id,data),  //修改购物车数量
    
    setvalue:(id,data)=>Patch('/api/cart/'+id,data), //增加减少数量
    setvalues:(id,data)=>Patch('/api/like/'+id,data), //增加减少数量

    AddToCart:(data,params)=>post('/api/cart',data,params), // 添加购物车

    setCartOne:(id,data)=>Patch('/api/cart/'+id,data),  


    savePlace:(params)=>get('/api/adress',params), 
    savePlaces:(data)=>post('/api/adress',data),  // 添加信息 
}